<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Skill
 *
 * @author 耿鸿飞 <15911185633>
 */
class Resume_Skill extends Model
{
    protected $tbl = 'resume_skill';
    /**
     * 添加技能
     * @param type $uid
     * @param type $rid
     * @param type $title
     * @param type $value
     * @return type
     */
    public function addSkill($uid,$rid,$title,$value){
        $data = array(
          "Fuid" => $uid,
            'Frid' => $rid,
            'Fkey' => $title,
            'Fvalue' => $value
        );
        return $this->insert($data);
    }
    /**
     * 编辑技能
     * @param type $fid
     * @param type $title
     * @param type $value
     * @return type
     */
    public function editSkill($fid,$title,$value){
        $data = array(
            'Fkey' => $title,
            'Fvalue' => $value
        );
        return $this->update($data,  sprintf("Fid=%d",$fid));
    }
    /**
     * 删除技能
     * @param type $fid
     * @return type
     */
    public function delSkill($fid){
        $data = array(
            'Fstatus' => 'Del'
        );
        return $this->update($data,  sprintf("Fid=%d",$fid));
    }
    /**
     * 获取简历的技能列表
     * @param type $rid
     * @return type
     */
    public function getSkils($rid){
        $rs = array();
        $sql = sprintf("SELECT * FROM %s WHERE Frid=%d AND Fstatus='Yes'",  $this->tbl,$rid);
        $list = $this->getResults($sql);
        if($list){
            foreach ($list AS $val){
                $rs[$val['Fid']] = $val;
            }
        }
        return $rs;
    }
}

?>
